﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace T01WPF
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            string username = txtnsername.Text.Trim();
            string password = txtpassword.Password.Trim();

            if (UserDao.LoginCheck(username,password)>=0)
            {
                MessageBox.Show("登陆成功");
                var mainWindow = new MainWindow();
                mainWindow.Title = "用户" + username + "登陆";
                mainWindow.Show();

                this.Close();
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
            }
        }

        private void txtnsername_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    }
}
